Define AlloyDB Sequences

Sequence is a new object that generates sequence of numbers. It is a user-defined object that is bound to a schema. A sequence object can be used with more than one table. You can also create a sequence cycle to repeat the sequential number after it reaches a limit.

Use the AlloyDB Sequence Editor to define a sequence in AlloyDB physical model.

To define a AlloyDB sequence

  1. In the Model Explorer, right-click Sequences and click New.

    An instance of Sequence is created.

  2. Right-click the instance and click Properties.

    The AlloyDB Sequence Editor opens.

  3. In the navigation grid, select the sequence that you want to define and work with the following options:

    Click New New icon in property editors to create a new object on the toolbar to create a sequence. Use the Enter filter text box to filter a very large list of sequences to quickly locate the one that you want to define.

    Name

    Specifies the name of the sequence. Set the name of the sequence in this field.

    Generate

    Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.

  4. On the AlloyDB tab, work with the following options:
    Schema

    Specifies the schema for the sequence. Select a schema from the drop-down list or click New New icon in property editors to create a new object to create one.

    Starting Value

    Allows the sequence to begin anywhere. The default starting value is minimum value for ascending sequences and maximum value for descending ones.

    Increment By

    Specifies which value is added to the current sequence value to create a new value. A positive value will make an ascending sequence, a negative one a descending sequence. The default value is 1.

    Minimum Value

    Specifies the minimum value a sequence can generate. If this clause is not supplied or NO MINVALUE is specified, default values are used.

    Maximum Value

    Specifies the maximum value a sequence can generate. If this clause is not supplied or NO MAXVALUE is specified, default values are used.

    Cache Capacity

    Specifies how many sequence numbers are to be preallocated and stored in memory for faster access. The minimum and default value is 1.

    Cycle Options

    Allows the sequence to wrap around when the maximum value or minimum value has been reached by an ascending or descending sequence respectively. If the limit is reached, the next number generated will be the minimum value or maximum value, respectively.

    If set to False is specified, any calls to next value after the sequence has reached its maximum value will return an error.

  5. (Optional) Click the Comment tab and enter any comments that you want to associate with the object.
  6. (Optional) Click the Where Used tab to view where the object is used within the model.
  7. (Optional) Click the UDPtab to work with user-defined properties for the object.
  8. (Optional) Click the Notestab to view and edit user notes.
  9. (Optional) Click the Extended Notes tab to view or edit user notes.
  10. Click Close.

    The sequence is defined and the AlloyDB Sequence Editor closes.

For more information, refer to AlloyDB documentation.